<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/default.xhtml">
   
   	<f:metadata>
	   	<f:viewParam name="serviceSupplierId" value="#{serviceSupplierHome.id}" ></f:viewParam>
	   	<f:event listener="#{serviceSupplierHome.initConversation()}" type="preRenderView"></f:event>
	   	<f:viewParam name="professionRatingRecordId" value="#{professionRatingRecordHome.id}" ></f:viewParam>
	   	<f:event listener="#{professionRatingRecordHome.initConversation()}" type="preRenderView"></f:event>
   	</f:metadata>
   	<ui:define name="head">
   		<style type="text/css">
			.column1 {
				width: 20%
			}
			
			.column2 {
				width: 80%
			}
		</style>
   	
   	</ui:define>
   	<ui:define name="content">
   
		<h:form id="editForm">
			<p:panel id="panel" header="评价" style="margin-bottom:10px;">
		        <p:messages id="messages" closable="true">
		       		<p:autoUpdate />
		       	</p:messages>
		        <h:panelGrid columns="2" cellpadding="5" columnClasses="column1,column2">
					<p:outputLabel value="中介机构"/>
					<h:outputText id="supplierName" value="#{serviceSupplierHome.instance.cnname}" />
					
					<p:outputLabel value="评分说明" />
					<p:outputLabel >
						<ui:include src="/WEB-INF/templates/RatingDesc.xhtml" />
					</p:outputLabel>
					<p:outputLabel value="评分" for="score"/>
					<p:outputLabel >
						<h:outputText id="output" value="当前评分为：#{professionRatingRecordHome.instance.score}分" />
						<ui:remove>
							<p:outputLabel id="scoreLabel" >
								<h:outputText value="&#160;&#160;" />
								<ui:include src="/WEB-INF/templates/outputTradeRating.xhtml" >
										<ui:param name="tradeRatingScore" value="#{professionRatingRecordHome.instance.score}" />
								</ui:include>
							</p:outputLabel>
						</ui:remove>
					 	<h:inputHidden  id="score"  value="#{professionRatingRecordHome.instance.score}" />
        				<p:slider for="score" 
        					display="output" 
        					displayTemplate="当前评分为： {value}分" 
        				 	minValue="0" 
							maxValue="30" 
        				 	step="1" style="width: 400px;margin-top:10px"
        				 />
					</p:outputLabel>
					
					<p:outputLabel for="rateText" value="评价说明"/>
					<p:inputTextarea id="rateText"
						required="true"
						value="#{professionRatingRecordHome.instance.rateText}"
						cols="50"
						rows="5"
					></p:inputTextarea>
				</h:panelGrid>
			</p:panel>
			<p:commandButton value="发布评价" rendered="#{! professionRatingRecordHome.hasRated}" action="#{professionRatingRecordHome.saveAndFlush()}"  />
			<ui:remove>
				<p:commandButton value="修改评价" rendered="#{professionRatingRecordHome.hasRated}"  action="#{professionRatingRecordHome.saveAndFlush()}"  />
			</ui:remove>
			<p:commandButton action="#{professionRatingRecordHome.cancel()}" value="取消" immediate="true"></p:commandButton>
		</h:form>
   	</ui:define>
</ui:composition>
